<?php 
/**
 *  工厂模式
 */

interface CarFactory
{
	public function makeCar();
}

interface Car
{
	public function getType();
}

Class SedanFactory implements CarFactory
{
	public function makeCar(){
		return new Sedan();
	}
}

class Sedan implements Car
{
	public function getType(){
		return 'Sedan';
	}
}

$factory = new SedanFactory();
$car = $factory->makekCar();
print $car->getType();
